<div id="app" v-cloak>
    <div class="flex-column">
        <div class="bottom20">
            <el-button type="primary" size="small" @click="common.add()">添加</el-button>
            <el-button type="primary" size="small" @click="common.refresh()"><el-icon :size="15"><Refresh /></el-icon>
            </el-button>
        </div>
        <el-table :data="list.rows" border style="width: 100%" :max-height="600" row-key="id">
            <!--            <el-table-column prop="id" label="ID" width="80" align="center"></el-table-column>-->
            <el-table-column prop="title" label="菜单名" align="left">
            </el-table-column>
            <el-table-column  label="类型">
                <template #default="scope">
                    {{scope.row.ismenu==1?'菜单':'权限'}}
                </template>
            </el-table-column>
            <el-table-column  label="图标">
                <template #default="scope">
                    <el-icon :size="20">
                        <Component :is="scope.row.icon"></Component>
                    </el-icon>
                </template>
            </el-table-column>
            <el-table-column prop="name"  label="标识">

            </el-table-column>
            <el-table-column prop="module"  label="模块">

            </el-table-column>
            <el-table-column prop="route"  label="路由">

            </el-table-column>
<!--            <el-table-column prop="pid" label="上级" align="center" ></el-table-column>-->
<!--            <el-table-column prop="rules" label="权限" align="center" show-overflow-tooltip></el-table-column>-->
            <el-table-column prop="status" label="状态" align="center">
                <template #default="scope">
                    <el-switch v-model="scope.row.status"  active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="changeSwitch(scope.row,`id`,`status`)"></el-switch>
                </template>
            </el-table-column>
            <el-table-column prop="status" label="操作" align="center">
                <template #default="scope">
                    <el-button type="primary" size="small" @click="common.edit(scope.row,`id`)">编辑</el-button>
                    <el-button type="danger" :disabled="scope.row.id==1?true:false" size="small" @click="del(scope.row)">删除</el-button>
                </template>
            </el-table-column>
        </el-table>
        <div class="flex-row flex-content-end top20">
            <el-pagination hide-on-single-page background layout="total, sizes, prev, pager, next, jumper" :total="list.total" @change="changePage" @size-change="changeSize"/>
        </div>
    </div>
</div>